import {CHANGE_BANNER_LIST,CHANGE_NEWSONG_LIST} from './actionType'
const defaultStore = {
  banner:[],
  newSong:[],
  hasMore:false
}
const reducer = (state=defaultStore,actions) => {
    if(actions.type===CHANGE_BANNER_LIST) {
       const newState=JSON.parse(JSON.stringify(state))
       console.log(actions);
       newState.banner=actions.value
       return newState
    }
    if(actions.type===CHANGE_NEWSONG_LIST) {
       const newState = JSON.parse(JSON.stringify(state))
       if(actions.value.length>0) {
         newState.hasMore = true
       } else {
          newState.hasMore = false
       }
       newState.newSong = newState.newSong.concat(actions.value)
       return newState
    }

    return state
}
export default reducer